
const _recordLastUpEight = Symbol('_recordLastUpEight');
const _countEightDirection = Symbol('_countEightDirection');
export default class UtilsRockerDirection {

    static [_recordLastUpEight](_options, _that) {
        _that.input.on('pointerup', () => {
            _that[_options.RockerDirection.lastUpKey] = Math.round((((Math.atan2(_options.RockerDirection.deltaY, _options.RockerDirection.deltaX) * (180 / Math.PI)) + 180) / 50));
        });
    }

    static [_countEightDirection](_options, _lastUp = 2) {
        if (_options.RockerDirection.deltaY == 0 && _options.RockerDirection.deltaX == 0) return _lastUp; // 12点方向 -基点
        return Math.round((((Math.atan2(_options.RockerDirection.deltaY, _options.RockerDirection.deltaX) * (180 / Math.PI)) + 180) / 50));
    }

    static init(_options, _that, _lastUp) {
        switch (_options.RockerDirection.type) {
            case 'recordLastUpEight':
                this[_recordLastUpEight](_options, _that);
                break
            case 'countEightDirection':
                return this[_countEightDirection](_options, _lastUp);
        }
    }
}